package panel.viewSpots
{
	import assists.HtmlText;
	import assists.Scale9Grid;
	import assists.TextFieldUtils;
	import assists.resource.ResourceLoader;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.text.TextField;
	
	public class BtnCloureeComment extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _normalBmp:Scale9Grid;
		private var _clickBmp:Scale9Grid;
		private var _label:TextField = new TextField();
		public function BtnCloureeComment(loader:ResourceLoader,stage:Stage)
		{
			_loader = loader;
			_stage = stage;
			init();
		}
		
		private function init():void
		{
			_label.mouseEnabled = false;
			_label.autoSize = "left";
			_normalBmp = new Scale9Grid(_loader.uiManager.generateBmp(_loader.uiManager.commentBtn).bitmapData,20,20);
			_normalBmp.width = _stage.stageWidth * 0.8;
			_normalBmp.height = _stage.stageHeight * 0.08;
			_clickBmp = new Scale9Grid(_loader.uiManager.generateBmp(_loader.uiManager.commentBtnClick).bitmapData,20,20);
			_clickBmp.width = _normalBmp.width;
			_clickBmp.height = _normalBmp.height;
			
			this.addChild(_normalBmp);
			this.addChild(_clickBmp);
			this.addChild(_label);
		}
		
		public function show(label:String,state:int):void
		{
			TextFieldUtils.setHtmlText(_label,HtmlText.formatSizeColor(label,0xffffff));
			if(state == 1)//
			{
				_normalBmp.visible = false;
				_clickBmp.visible = true;
			}else
			{
				_normalBmp.visible = true;
				_clickBmp.visible = false;
			}
			_label.x = (_normalBmp.width - _label.width) * 0.5;
			_label.y = (_normalBmp.height - _label.height) * 0.5;
		}
		
//		public override function get width():Number
//		{
//			return _normalBmp.width;
//		}
//		
	}
}